﻿
''' <summary>
''' Class representing a zip comment.
''' </summary>
Public Class Comment
    'Ctor :
    ''' <summary>
    ''' Creates a new Comment instance.
    ''' </summary>
    Public Sub New()
        Me.Reset()
    End Sub
    'Fields :
    ''' <summary>
    ''' Embed or not zip infos into the comment.
    ''' </summary>
    Public Property EmbedZipInfos As Boolean
    ''' <summary>
    ''' Comment text.
    ''' </summary>
    Public Property Text As String
    'Routines :
    ''' <summary>
    ''' Reset Comment to default.
    ''' </summary>
    Public Sub Reset()
        EmbedZipInfos = False
        Text = Nothing
    End Sub
    ''' <summary>
    ''' Copies Comment values from another Comment object.
    ''' </summary>
    ''' <param name="com">Comment object from wich copy value</param>
    Public Sub CopyFrom(ByVal com As Comment)
        Me.EmbedZipInfos = com.EmbedZipInfos
        Me.Text = com.Text
    End Sub
    ''' <summary>
    ''' Applies Comment to the given zip file.
    ''' </summary>
    ''' <param name="zip">zipFile instance</param>
    Public Sub ApplyToZip(ByVal zip As Zip.ZipFile, ByVal zipinfos As String)
        Dim com As String = ""
        zip.Comment = Me.Text
        If EmbedZipInfos = True Then
            zip.Comment &= vbNewLine & zipinfos
        End If
    End Sub
End Class